var orderDetail = {};

   		
//获取订单信息
orderDetail.info =function(){   	
    var args = getQueryStringArgs();
	var orderId = args["orderId"];
    var ajax = new $ax(Feng.ctxPath+"/order/getById", function(data){        
        if (data.success){
        	template.helper('dateFormat', function (inp) {
		        if(inp!=="" && inp!==null){
		            return inp.split(' ')[0];
		        }
		    });
        	
        	//价格过滤器
		    template.helper('priceFormat', function (inp) {
		        if(inp!==""){
		            return numeral(inp).format('0,0.00');
		        }
		    });
		    
		    //图片过滤器
		    template.helper('pictureFormat', function (inp) {
		       if(inp){
		           return Feng.ctxPath+"/file/getImage/"+inp;
		       }
		       else{
		        	return "themes/img/pd/course_defult.jpg";
		       }
		    });
		    
		    	//支付方式
		    template.helper('paymentFormat', function (inp) {
		       if(inp==="2"){
		            return "微信支付";
		       }
		       else if(inp==="1"){
		        	return "线下支付";
		       }
		       else if(inp==="3"){
		       	    return "线下支付";
		       }
		    });
		    
        	
        	var outHtml = template("dataTmpl",data.obj);
    		$("#order-box").html(outHtml);    
    		
    		$("#total-price").html("￥"+numeral(data.obj.actualOrderAmount).format('0,0.00'));
        }
        else if(data.code === 2){
        	Feng.open("订单查询失败");
        }
        else{
        	Feng.log("订单查询失败");
        }        
   },function(data){    	
        Feng.log("订单查询失败");
    });
    ajax.set({id:orderId});
    ajax.start();
    
};


///api/user/userOrder 查询用户的订单  参数 userId

$(function(){
	orderDetail.info();
});
